#!/bin/bash

TEST_DATA=0
DO_AGGR=1
DO_QUERY=1
ALLOC_POLICY=fixed
# ALLOC_POLICY=population

BASE_CMD="python src/sim.py -rt"
AGGR_CMD="${BASE_CMD} -d"
QUERY_CMD="${BASE_CMD} -q"

if [ ${TEST_DATA} = 1 ] ; then
    AGGR_CMD="${AGGR_CMD} -t"
    QUERY_CMD="${QUERY_CMD} -t"
fi

mappings=(a b c)
s_maps=(0.25 0.5 1.0 2.0)
# s_maps=(0.5)
lambdas=(0.1 1 10 100)
# lambdas=(10 100)
# lambdas=(0.1 1)

function run_cmd { echo "$1"; eval $1; }
# function run_cmd { echo "$1" ; }
function run_aggr {
    if [ ${DO_AGGR} = 1 ] ; then
        run_cmd "${AGGR_CMD} $1"
    fi
}
function run_query {
    if [ ${DO_QUERY} = 1 ] ; then    
        run_cmd "${QUERY_CMD} $1"
    fi
}

for mapping in ${mappings[@]} ; do
    for sm in ${s_maps[@]} ; do
        run_aggr "-m ${mapping} -sm ${sm} -ap ${ALLOC_POLICY}"
    done
    for lambda in ${lambdas[@]} ; do
        run_query "-m ${mapping} -l ${lambda} -ap ${ALLOC_POLICY}"
    done
done

